<!DOCTYPE html>
<html lang="en">
<head>
	<meta charset="UTF-8">
	<title>Document</title>
</head>
<body>
	<p>
		<input type="text" id="username">
	</p>
	<p>
		<input type="text" id="age">
	</p>
	<p>
		<input type="button" value="提交" id="btn">
	</p>
	<script type="text/javascript">
		var btn = document.getElementById('btn');
		var username = document.getElementById('username');
		var age = document.getElementById('age')
		btn.onclick = function () {
			var xhr = new XMLHttpRequest();

			var nameValue = username.value;
			var ageValue = age.value;

			var params = 'username='+nameValue+'&age=' +ageValue;

			xhr.open('get','http://localhost:3000/get?'+params);
			xhr.send();
			xhr.onload = function () {
				console.log(xhr.responseText);
			  }
			
		  }
	</script>
</body>
</html>